package hczc.longcai.com.hccrowdfunding.home.second_invest.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;
import hczc.longcai.com.hccrowdfunding.home.second_invest.beans.ProjectDynamic;

/**
 * Created by Administrator on 2016/1/12.
 */
public class ProjectDynamicAdapter extends BaseAdapter {

    private Context context;
    private List<ProjectDynamic> list;

    public ProjectDynamicAdapter(Context context, List<ProjectDynamic> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if(view == null){
            holder = new ViewHolder();
            view = LayoutInflater.from(context).inflate(R.layout.item_invest_profectdynamic,null);
            BaseApplication.scaleScreenHelper.loadView(((ViewGroup) view));
            holder.time = ((TextView) view.findViewById(R.id.invest_project_dynamic_listview_time));
            holder.details = ((TextView) view.findViewById(R.id.invest_project_dynamic_listview_details));
            view.setTag(holder);
        }
        holder = ((ViewHolder) view.getTag());
//        holder.time.setText(list.get(i).getTime());
//        holder.details.setText(list.get(i).getDetails());


        return view;
    }

    class ViewHolder{
        TextView time,details;
    }
}
